import 'package:flutter/material.dart';

import '../services/ScreenAdapter.dart';

class MyText extends StatelessWidget {
  final String text;
  final bool obscureText;   // true是密码框, false普通文本框
  final Object onChange;
  MyText({this.text='请输入内容', this.obscureText = false,this.onChange});

  @override
  Widget build(BuildContext context) {
    return Container(
      height: ScreenAdapter.height(78),
      margin: EdgeInsets.all(20),
      decoration: BoxDecoration(
          border: Border(bottom: BorderSide(color: Colors.black12))),
          child: TextField(
              obscureText: this.obscureText,
              decoration: InputDecoration(
                  contentPadding: EdgeInsets.all(0),
                  border: OutlineInputBorder(
                    borderRadius: BorderRadius.circular(30),
                    borderSide: BorderSide.none,
                  ),
                  labelText: this.text,
                  labelStyle: TextStyle(fontSize: 14, color: Colors.black38)
              ),
              onChanged: this.onChange,
          ),
    );
  }
}

